import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpCoreUser {
  id!: number;
  username!: string;
  password!: string;
  salt!: number;
  isAdmin?: boolean = false;
  isCoreAdmin?: boolean;
  uniacid!: number;
  addTime!: string;
  updateTime!: string;
  token!: string;
}

export const ImsYzdKpCoreUserSchema = new EntitySchema({
  class: ImsYzdKpCoreUser,
  properties: {
    id: { primary: true, type: 'number' },
    username: { type: 'string', length: 255 },
    password: { type: 'string', length: 255 },
    salt: { type: 'number' },
    isAdmin: { type: 'boolean', nullable: true, default: false },
    isCoreAdmin: { type: 'boolean', nullable: true },
    uniacid: { type: 'number', index: 'uniacid' },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    token: { type: 'string', length: 255 },
  },
});
